<?php
    session_start();
        if(!isset($_SESSION["usuario"]) || !isset ($_SESSION["senha"]) ){
            header("Location: auth/");
            exit;
        } else{
    }
	
		$protocolo    = (strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === false) ? 'http' : 'https';		 
		$host         = $_SERVER['HTTP_HOST'];		 
		$script       = $_SERVER['SCRIPT_NAME'];		 
		$parametros   = $_SERVER['QUERY_STRING'];		 
		$UrlAtual     = $protocolo . '://' . $host . $script . '?' . $parametros;		
	
    include 'class/database.php';
    $pdo = Database::connect();
?>
<!--Informações de conexão sempre acima da Estrutura-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt" xml:lang="pt">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
	<title><?php echo $titulop ?></title>
    <!--CSS-->
	<link  href="css/estilos.css" rel="stylesheet">
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
    <!--/CSS-->
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    <script src="uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="uploadify/uploadify.css">
        

    <script type="text/javascript" src="js/tinymce/tinymce.min.js"></script>
    <script type="text/javascript">

     tinymce.init({
        selector: "textarea",
      // ===========================================
      // INCLUDE THE PLUGIN
      // ===========================================

      plugins: [
        "advlist autolink lists link image charmap print preview anchor",
        "searchreplace visualblocks code fullscreen",
        "insertdatetime media table contextmenu paste jbimages"
      ],

      // ===========================================
      // PUT PLUGIN'S BUTTON on the toolbar
      // ===========================================

      toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent",

      // ===========================================
      // SET RELATIVE_URLS to FALSE (This is required for images to display properly)
      // ===========================================

      relative_urls: false,
    });
    $(document).on('focusin', function(e) {
    if ($(event.target).closest(".mce-window").length) {
        e.stopImmediatePropagation();
    }
    });
    </script>
    <!--Seleciona All Checkbox-->             
	<script language="JavaScript">
    function toggle(source) {
      checkboxes = document.getElementsByName('foo[]');
      for(var i=0, n=checkboxes.length;i<n;i++) {
        checkboxes[i].checked = source.checked;
      }
    }
    </script>
    <!--/Seleciona All Checkbox-->             
        <!--Menu Selecionado-->
    <script>
    $(function() {
         var pgurl = window.location.href.substr(window.location.href
    .lastIndexOf("/")+1);
         $("nav a").each(function(){
              if($(this).attr("href") == pgurl)
              $(this).addClass("selected");
         })
    });
    </script>
    <!--/Menu Selecionado--> 


</head>
<body>
    <div id="wrapper">

      <!-- Sidebar -->
      <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="home">CMS - <?php echo $empresa ?></a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-ex1-collapse">
          <ul class="nav navbar-nav side-nav">
            <li><a href="<?php echo $home ?>"><i class="fa fa-dashboard"></i> <?php echo $ssdashboard ?></a></li>
            <li><a href="usuarios"><i class="fa fa-users"></i> <?php echo $ssusuarios ?></a></li>      
            <li><a href="posts"><i class="fa fa-indent"></i> <?php echo $ssposts ?></a></li>
          </ul>

            <div style="float: right; padding: 15px 0; color: #fff; text-transform: uppercase">
                <i class="fa fa-user"></i> <?php echo $_SESSION["usuario"];//exibe?>
                &nbsp;
                <a style="color: #fff" href="auth/logout.php"><i class="fa fa-power-off"></i> Sair</a>
            </div>
        </div><!-- /.navbar-collapse -->
      </nav>